<template>
  <a-card :bordered="false">

    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">

          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="订单号">
              <a-input placeholder="请输入订单号" v-model="queryParam.orderNo"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="订单状态">
				<a-select v-model="queryParam.status" placeholder="请选择订单类型">
				  <a-select-option :value="item.id" v-for="(item,index) in statusList" :key="index">{{item.name}}</a-select-option>
				</a-select>
            </a-form-item>
          </a-col>
		  <a-col :xl="6" :lg="7" :md="8" :sm="24">
		    <a-form-item label="宝妈手机号">
		  		<a-input placeholder="请输入宝妈手机号" v-model="queryParam.mamiPhoneNum"></a-input>
		    </a-form-item>
		  </a-col>
		  <a-col :xl="6" :lg="7" :md="8" :sm="24">
		    <a-form-item label="月嫂手机号">
		  		<a-input placeholder="请输入月嫂手机号" v-model="queryParam.nannyPhoneNum"></a-input>
		    </a-form-item>
		  </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>

        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <!-- <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-button type="primary" icon="download" @click="handleExportXls('订单记录')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
      </a-dropdown>
    </div> -->

    <!-- table区域-begin -->
    <div>
     <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div> -->

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
		 @change="handleTableChange">
		<span slot="isMarginSub" slot-scope="text, record">
			{{text == 1 ? '已交' : '未交'}}
		</span>
		<span slot="status" slot-scope="text, record">
			{{statusList[text].name}}
		</span>
		<span slot="isDepositSub" slot-scope="text, record">
			{{text == 1 ? '已交' : '未交'}}
		</span>
		<span slot="isBalanceSub" slot-scope="text, record">
			{{text == 1 ? '已交' : '未交'}}
		</span>
		<span slot="realGrade" slot-scope="text, record">
			{{record.interList == 0 ? '' : record.interList[0].status == 0 ? '' : record.interList[0].status == 1 ? '通过' : '未通过'}}
		</span>
        <span slot="action" slot-scope="text, record">
		  <a @click="handleInterview(record)" v-if="record.interList.length == 0 && record.status == 2">面试邀请</a>
		  
		  <a @click="handleInterviewDetail(record)" v-if="record.interList.length > 0 && record.status >= 2">面试详情</a>
		  
		  <a-divider type="vertical" v-if="record.status == 7" />
		  <a @click="handleEvaluate(record)" v-if="record.status == 7">评价</a>
		  
		  <a-divider type="vertical" v-if="record.status == 8" />
		  <a @click="handleEvaluate(record)" v-if="record.status == 8">评价详情</a>
		  
        </span>

      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
	<wechatEvaluate-modal ref="modalForm" @ok="modalFormOk"></wechatEvaluate-modal>
<!--    <wechatOoreder-modal ref="modalForm" @ok="modalFormOk"></wechatOoreder-modal> -->
	<InterviewModal ref="InterviewModal" @ok="modalFormOk"></InterviewModal>
	<InterviewDetailModal ref="InterviewDetailModal" @ok="modalFormOk"></InterviewDetailModal>
  </a-card>
</template>

<script>
  import '@/assets/less/TableExpand.less'
  import WechatOorederModal from './modules/WechatOorederModal'
  import InterviewModal from './modules/InterviewModal'
  import InterviewDetailModal from './modules/InterviewDetailModal'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 import WechatEvaluateModal from './modules/WechatEvaluateModal'
  export default {
    name: "WechatOorederList",
    mixins:[JeecgListMixin],
    components: {
      WechatOorederModal,
	  InterviewModal,
	  InterviewDetailModal,
	  WechatEvaluateModal
    },
    data () {
      return {
        description: '订单记录管理页面',
		statusList: [{
			id:0,
			name:'待宝妈同意'
		},{
			id:1,
			name:'待月嫂同意'
		},{
			id:2,
			name:'待面试 '
		},{
			id:3,
			name:'待签署'
		},{
			id:4,
			name:''
		},{
			id:5,
			name:'待服务 '
		},{
			id:6,
			name:'服务中'
		},{
			id:7,
			name:'待评价 '
		},{
			id:8,
			name:'订单结束 '
		},{
			id:9,
			name:'订单关闭 '
		},{
			id:10,
			name:'订单过期 '
		},{
			id:11,
			name:'订单终止'
		}],
        // 表头
        columns: [
          // {
          //   title: '#',
          //   dataIndex: '',
          //   key:'rowIndex',
          //   width:60,
          //   align:"center",
          //   customRender:function (t,r,index) {
          //     return parseInt(index)+1;
          //   }
          //  },
		   {
            title: '订单号',
            align:"center",
            dataIndex: 'orderNo'
           },
		   {
		    title: '宝妈',
		    align:"center",
		    dataIndex: 'mamiName'
		   },
		   {
		    title: '宝妈手机号',
		    align:"center",
		    dataIndex: 'mamiPhoneNum'
		   },
		   {
		    title: '月嫂',
		    align:"center",
		    dataIndex: 'nannyName'
		   },
		   {
		    title: '月嫂手机号',
		    align:"center",
		    dataIndex: 'nannyPhoneNum'
		   },
		   {
		    title: '订单金额（元）',
		    align:"center",
		    dataIndex: 'orderAmount'
		   },
		   {
            title: '订单状态',
            align:"center",
            dataIndex: 'status',
			scopedSlots: { customRender: 'status' },
           },
		   {
		    title: '保证金状态',
		    align:"center",
		    dataIndex: 'isMarginSub',
			scopedSlots: { customRender: 'isMarginSub' },
		   },
		   {
		    title: '定金状态',
		    align:"center",
		    dataIndex: 'isDepositSub',
			scopedSlots: { customRender: 'isDepositSub' },
		   },
		   {
		    title: '尾款状态',
		    align:"center",
		    dataIndex: 'isBalanceSub',
			scopedSlots: { customRender: 'isBalanceSub' },
		   },
		   {
		    title: '面试状态',
		    align:"center",
		    dataIndex: 'realGrade',
		   	scopedSlots: { customRender: 'realGrade' },
		   },
		   {
		    title: '创建时间',
		    align:"center",
		    dataIndex: 'createTime'
		   },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            scopedSlots: { customRender: 'action' },
          }
        ],
		url: {
          list: "/wechat/wechatOreder/list",
          delete: "/wechat/wechatOreder/delete",
          deleteBatch: "/wechat/wechatOreder/deleteBatch",
          exportXlsUrl: "wechat/wechatOreder/exportXls",
          importExcelUrl: "wechat/wechatOreder/importExcel",
       },
    }
  },
  computed: {
    importExcelUrl: function(){
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    }
  },
    methods: {
		handleEvaluate(record){
			this.$refs.modalForm.edit(record);
			this.$refs.modalForm.title = "编辑";
			// this.$refs.modalForm.disableSubmit = false;
		}
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>